:root {
  --patrol-bg: #fffaf2;
  --patrol-panel: #fffdf8;
  --patrol-text: #2b201b;
  --patrol-muted: #76675f;
  --patrol-line: #d9cdc4;
  --patrol-wood: #6f4634;
  --patrol-green: #536a3f;
}

body[data-page="patrol"] .uranus-app-frame__body-content {
  overflow-x: auto;
}

body[data-page="patrol"] .uranus-app-frame__body-content.app-table-grid-snap {
  touch-action: none;
  overscroll-behavior: contain;
  cursor: grab;
}

body[data-page="patrol"] .uranus-app-frame__body-content.app-table-grid-snap.app-table-grid-dragging {
  cursor: grabbing;
  user-select: none;
}

.patrol-drawer {
  min-height: 48px;
  display: grid;
  gap: 6px;
  padding: 7px 9px;
  background: linear-gradient(180deg, #fffaf2, #f6e9df);
}

.patrol-date-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 7px;
}

.patrol-date-nav {
  width: 34px;
  height: 32px;
  border: 1px solid var(--patrol-line);
  border-radius: 4px;
  background: #fffdf8;
  color: var(--patrol-wood);
  font-size: 20px;
  font-weight: 900;
}

.patrol-date-field {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  color: var(--patrol-wood);
  font-size: 11px;
  font-weight: 900;
}

.patrol-date-field input {
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 0 7px;
  border: 1px solid var(--patrol-line);
  border-radius: 4px;
  background: #fffdf8;
  color: var(--patrol-text);
  font-size: 16px;
  font-weight: 800;
}

.patrol-room-visibility {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 9px;
  border: 1px solid var(--patrol-line);
  border-radius: 4px;
  background: #fffdf8;
  color: var(--patrol-text);
  font-size: 11px;
  font-weight: 900;
}

.patrol-room-visibility strong { color: var(--patrol-muted); font-size: 10px; }
.patrol-room-visibility[aria-pressed="true"] { border-color: var(--patrol-green); background: #eef4e9; }
.patrol-room-visibility[aria-pressed="true"] strong { color: var(--patrol-green); }

.patrol-page {
  min-width: 478px;
  min-height: 100%;
  color: var(--patrol-text);
  background: var(--patrol-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
}

.patrol-table {
  width: 478px;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  background: var(--patrol-panel);
  font-size: 11px;
}

.patrol-table th,
.patrol-table td {
  height: 26px;
  padding: 2px;
  border-right: 1px solid var(--patrol-line);
  border-bottom: 1px solid var(--patrol-line);
  text-align: center;
  vertical-align: middle;
}

.patrol-table th {
  position: sticky;
  z-index: 4;
  top: 0;
  height: 22px;
  color: #fffaf2;
  background: #6f4634;
  font-size: 10px;
  font-weight: 900;
}

.patrol-room { width: 28px; font-size: 9px; }
.patrol-name { width: 74px; overflow: hidden; text-align: left !important; text-overflow: ellipsis; white-space: nowrap; font-weight: 900; }
.patrol-slot { width: 54px; }
.patrol-other { width: 214px; text-align: left !important; }

.patrol-sticky,
.patrol-sticky-name {
  position: sticky;
  z-index: 2;
  background: #fff9ef;
}

.patrol-sticky { left: 0; }
.patrol-sticky-name { left: 28px; }
.patrol-table th.patrol-sticky,
.patrol-table th.patrol-sticky-name { z-index: 6; background: #5f3b2d; }

.patrol-check {
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  font-weight: 800;
}

.patrol-check:active { background: #f4e4dc; }
.patrol-check.pending-save { background: #eef4ff; }
.patrol-check.saving { background: #fff7d6; }
.patrol-check.error { background: #fee2e2; }
.patrol-check.is-editing { padding: 1px; user-select: text; }
.patrol-other-input {
  width: 100%;
  height: 22px;
  padding: 1px 4px;
  border: 1px solid #bda18f;
  border-radius: 3px;
  background: #fffef9;
  color: var(--patrol-text);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
}
.patrol-check.is-hospitalized { cursor: default; color: #876c61; background: #eee8e3; }
.patrol-check.is-selected { position: relative; z-index: 3; box-shadow: inset 0 0 0 2px #2f6f52; }
.patrol-table tr.is-targeted td.patrol-name {
  color: #fff;
  background: #2f6f52;
  box-shadow: inset 0 0 0 2px #24563f;
}
.patrol-table tr.absent-row td { color: #8b7b72; background: #eeeae6; }
.patrol-table tr.absent-row td.patrol-sticky,
.patrol-table tr.absent-row td.patrol-sticky-name { background: #e4ddd7; }

.patrol-hide-room .patrol-room { display: none; }
.patrol-hide-room .patrol-sticky-name { left: 0; }
.patrol-hide-room .patrol-page { min-width: 450px; }
.patrol-hide-room .patrol-table { width: 450px; }

.patrol-message {
  height: 100px !important;
  color: var(--patrol-muted);
  text-align: center !important;
}
.patrol-message.is-error { color: #a82d3c; }

.patrol-footer {
  width: 100%;
  display: grid;
  gap: 5px;
  padding: 6px;
  border-top: 1px solid var(--patrol-line);
  background: var(--patrol-bg);
  box-shadow: 0 -3px 14px rgba(63, 41, 32, .16);
}

.patrol-selected-row {
  min-width: 0;
  min-height: 34px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.patrol-selected-name {
  min-width: 0;
  overflow: hidden;
  color: var(--patrol-text);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 900;
}

.patrol-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.patrol-slot-actions,
.patrol-value-actions,
.patrol-person-actions { display: grid; gap: 10px; }
.patrol-slot-actions { grid-template-columns: repeat(3, 42px); gap: 6px; }
.patrol-value-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.patrol-person-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.patrol-slot-actions button,
.patrol-value-actions button,
.patrol-person-actions button {
  min-width: 0;
  border: 1px solid var(--patrol-line);
  border-radius: 4px;
  background: #fffdf8;
  color: var(--patrol-text);
  font-size: 12px;
  font-weight: 900;
}

.patrol-slot-actions button { width: 42px; height: 32px; padding: 0; font-size: 10px; }
.patrol-value-actions button { height: 40px; }
.patrol-person-actions button { height: 34px; background: #f2ece7; color: var(--patrol-wood); }
.patrol-slot-actions button.is-active,
.patrol-value-actions button.is-active { border-color: var(--patrol-green); color: #fff; background: var(--patrol-green); }
.patrol-slot-actions button:disabled,
.patrol-value-actions button:disabled,
.patrol-person-actions button:disabled { opacity: .38; }

@media (min-width: 700px) {
  .patrol-page { min-width: 520px; }
  .patrol-name { width: 88px; }
  .patrol-sticky-name { left: 28px; }
  .patrol-hide-room .patrol-sticky-name { left: 0; }
  .patrol-hide-room .patrol-page { min-width: 492px; }
  .patrol-hide-room .patrol-table { width: 492px; }
  .patrol-other { width: 234px; }
}
