:root {
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  color: #202a33;
  background: #f5f7f8;
  font-synthesis: none;
  --green: #147d56;
  --green-dark: #0e6545;
  --green-soft: #e8f5ef;
  --line: #dce3e7;
  --line-strong: #c7d1d7;
  --muted: #6e7b84;
  --paper: #ffffff;
  --blue: #91c8ea;
  --blue-border: #70b4df;
  --blue-ink: #164b6b;
  --break: #82c990;
  --memo: #f1f6f7;
  --yellow: #fff7d7;
  --name-width: 178px;
  --quarter-width: 20px;
  --timeline-width: 1360px;
  --field-width: 118px;
  --radius: 6px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  color: #202a33;
  background: #f5f7f8;
  letter-spacing: 0;
}

body {
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  background: #f5f7f8;
}

.topbar {
  min-height: 70px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(500px, 1fr);
  align-items: center;
  gap: 20px;
  padding: 10px 16px;
  border-top: 4px solid #e1f2e9;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--green);
  color: #ffffff;
  font-size: 24px;
  font-weight: 700;
}

.brand-title {
  margin: 0;
  overflow: hidden;
  font-size: 17px;
  line-height: 1.25;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-period {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.breadcrumb {
  color: #74818a;
  font-size: 11px;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.save-status {
  min-width: 70px;
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  text-align: right;
}

.toolbar-divider {
  width: 1px;
  height: 30px;
  margin: 0 2px;
  background: var(--line);
}

.icon-button,
.toolbar-button,
.staff-add-button,
.date-arrow {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: #26343e;
  font-size: 11px;
  font-weight: 700;
}

.icon-button {
  width: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 19px;
}

.icon-button:disabled {
  color: #bcc5ca;
  cursor: default;
}

.toolbar-button,
.staff-add-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  white-space: nowrap;
}

.toolbar-button.primary {
  border-color: var(--green);
  background: var(--green);
  color: #ffffff;
}

.mobile-action-label {
  display: none;
}

.toolbar-button:hover,
.staff-add-button:hover,
.icon-button:not(:disabled):hover,
.date-arrow:hover {
  background: #f0f5f3;
  border-color: #aec6ba;
}

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

.date-strip-wrap {
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.date-strip {
  min-height: 62px;
  display: flex;
  align-items: stretch;
  gap: 3px;
  padding: 7px 12px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.date-arrow {
  width: 35px;
  min-width: 35px;
  align-self: center;
  color: #7b8991;
  font-size: 18px;
}

.date-tab {
  width: 96px;
  min-width: 96px;
  display: grid;
  grid-template-columns: 1fr 24px;
  align-items: center;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: #222e37;
}

.date-tab:hover {
  background: #f4f7f8;
}

.date-tab[aria-current="date"] {
  border-color: #b7dfcc;
  background: var(--green-soft);
  color: var(--green-dark);
}

.date-main {
  font-size: 14px;
  font-weight: 700;
}

.date-side {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.date-side.weekend {
  color: #c44d48;
}

.page-head {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 15px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.date-heading-row {
  display: flex;
  align-items: baseline;
  gap: 18px;
}

.date-heading {
  margin: 0;
  font-size: 19px;
  line-height: 1.35;
}

.work-total {
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.day-meta {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.page-head-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.legend {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 10px;
}

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

.legend-swatch {
  width: 22px;
  height: 9px;
  border-radius: 2px;
  background: var(--blue);
}

.legend-swatch.break {
  background: var(--break);
}

.store-memo {
  min-height: 44px;
  display: grid;
  grid-template-columns: 165px minmax(0, 1fr);
  align-items: stretch;
  border-bottom: 1px solid #eadfae;
  background: var(--yellow);
}

.store-memo-label {
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: #39464f;
  font-size: 11px;
  font-weight: 700;
}

.store-memo-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-left: 1px solid #eadfae;
  outline: 0;
  background: transparent;
  color: #39464f;
  resize: none;
  font-size: 11px;
}

.schedule-scroller {
  width: 100%;
  overflow: auto;
  border-bottom: 1px solid var(--line-strong);
  background: #ffffff;
}

.schedule-grid {
  width: calc(var(--name-width) + var(--timeline-width) + var(--field-width) * 4);
  min-width: calc(var(--name-width) + var(--timeline-width) + var(--field-width) * 4);
}

.schedule-header,
.count-row,
.work-row,
.memo-row {
  display: grid;
  grid-template-columns: var(--name-width) var(--timeline-width) repeat(4, var(--field-width));
}

.schedule-header {
  height: 42px;
  border-bottom: 1px solid var(--line-strong);
  background: #ffffff;
}

.header-name,
.field-header,
.count-name,
.row-name,
.memo-name,
.time-cell {
  border-right: 1px solid var(--line-strong);
}

.header-name,
.field-header,
.count-name {
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 10px;
  font-weight: 700;
}

.field-header {
  justify-content: center;
  padding: 0 4px;
}

.hour-axis,
.timeline-track,
.count-track {
  position: relative;
  width: var(--timeline-width);
  background-image:
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent 19px,
      #edf1f3 19px,
      #edf1f3 20px
    ),
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent 79px,
      #cbd6dc 79px,
      #cbd6dc 80px
    );
}

.hour-axis {
  border-right: 1px solid var(--line-strong);
}

.hour-label {
  position: absolute;
  top: 11px;
  width: calc(var(--quarter-width) * 4);
  padding-left: 2px;
  color: #52616b;
  font-size: 9px;
  font-weight: 700;
}

.count-row {
  height: 34px;
  border-bottom: 1px solid var(--line-strong);
  background: #eef2f4;
}

.count-name {
  background: #eef2f4;
}

.count-track {
  display: grid;
  grid-template-columns: repeat(68, var(--quarter-width));
  border-right: 1px solid var(--line-strong);
  background-color: #eef2f4;
}

.count-cell {
  display: grid;
  place-items: center;
  color: #60707a;
  font-size: 8px;
  font-variant-numeric: tabular-nums;
}

.count-placeholder {
  border-right: 1px solid var(--line-strong);
  background: #eef2f4;
}

.staff-block {
  border-bottom: 1px solid var(--line-strong);
}

.work-row {
  height: 54px;
  background: #ffffff;
}

.row-name {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  background: #ffffff;
}

.staff-name-input {
  width: 100%;
  min-width: 0;
  padding: 7px 2px;
  overflow: hidden;
  border: 0;
  outline: 0;
  background: transparent;
  color: #26323b;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
}

.staff-name-input::placeholder {
  color: #a7b1b7;
  font-weight: 500;
}

.row-delete-button,
.time-clear-button {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #8b979f;
  line-height: 1;
}

.row-delete-button {
  width: 26px;
  height: 28px;
  font-size: 17px;
}

.row-delete-button:hover,
.time-clear-button:not(:disabled):hover {
  background: #f1f4f5;
  color: #3f4d56;
}

.timeline-track {
  height: 54px;
  border-right: 1px solid var(--line-strong);
  background-color: #ffffff;
  touch-action: pan-y;
}

.shift-block {
  position: absolute;
  top: 10px;
  height: 34px;
  min-width: var(--quarter-width);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0 10px;
  border: 1px solid var(--blue-border);
  border-radius: 4px;
  background: var(--blue);
  color: var(--blue-ink);
  cursor: grab;
  font-size: 10px;
  font-weight: 700;
  user-select: none;
  touch-action: none;
}

.shift-block.dragging {
  z-index: 3;
  cursor: grabbing;
  box-shadow: 0 3px 9px rgba(38, 72, 91, 0.22);
}

.shift-label {
  position: relative;
  z-index: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.break-segment {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 1;
  border-right: 1px solid #5daf6d;
  border-left: 1px solid #5daf6d;
  background: var(--break);
  pointer-events: none;
}

.resize-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 4;
  width: 10px;
  cursor: ew-resize;
}

.resize-handle.start {
  left: 0;
}

.resize-handle.end {
  right: 0;
}

.time-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0 4px;
  background: #ffffff;
}

.time-clear-button {
  width: 22px;
  height: 28px;
  font-size: 15px;
}

.time-clear-button:disabled {
  visibility: hidden;
}

.time-input {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 4px 2px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #52606a;
  font-size: 10px;
  text-align: center;
}

.memo-row {
  min-height: 34px;
  background: var(--memo);
}

.memo-name {
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: #87949c;
  background: #f5f7f8;
  font-size: 9px;
}

.staff-memo-input {
  grid-column: 2 / 3;
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border: 0;
  border-right: 1px solid var(--line-strong);
  outline: 0;
  background: var(--memo);
  color: #74828b;
  font-size: 9px;
  resize: none;
}

.memo-filler {
  border-right: 1px solid var(--line-strong);
  background: #f5f7f8;
}

.empty-note {
  padding: 28px;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 40px));
  padding: 10px 14px;
  border-radius: var(--radius);
  background: #263841;
  color: #ffffff;
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .topbar {
    grid-template-columns: minmax(230px, 1fr) minmax(0, auto);
  }

  .breadcrumb {
    display: none;
  }

  .top-actions {
    min-width: 0;
    overflow-x: auto;
  }
}

@media (max-width: 700px) {
  .topbar {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 8px 10px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }

  .brand-title {
    font-size: 15px;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 4px;
    overflow-x: hidden;
    padding-bottom: 2px;
  }

  .save-status {
    min-width: auto;
    font-size: 10px;
    text-align: left;
    white-space: nowrap;
  }

  .icon-button {
    width: 32px;
    min-height: 34px;
  }

  .toolbar-divider {
    display: none;
  }

  .toolbar-button {
    min-height: 34px;
    gap: 4px;
    padding: 0 8px;
    font-size: 10px;
  }

  .desktop-action-label {
    display: none;
  }

  .mobile-action-label {
    display: inline;
  }

  .date-strip {
    min-height: 56px;
  }

  .date-tab {
    width: 82px;
    min-width: 82px;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
    padding: 10px 12px;
  }

  .date-heading-row {
    gap: 10px;
  }

  .date-heading {
    font-size: 17px;
  }

  .page-head-actions {
    width: 100%;
    justify-content: space-between;
  }

  .store-memo {
    grid-template-columns: 96px minmax(0, 1fr);
  }
}
