*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', 'Meiryo', sans-serif;
  background: #eef1f6;
  color: #1a1a2e;
  min-height: 100vh;
}

#app {
  min-height: 100vh;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

.page-wide {
  max-width: 1100px;
}

.narrow {
  max-width: 420px;
  padding-top: 48px;
}

.app-title {
  text-align: center;
  font-size: 1.75rem;
  margin: 24px 0 8px;
}

.muted {
  color: #666;
}

.note {
  color: #666;
  font-size: 0.9rem;
  line-height: 1.5;
}

.home-buttons {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 32px auto;
  max-width: 360px;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 1rem;
  cursor: pointer;
  background: #3860b2;
  color: #fff;
  font-family: inherit;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-lg {
  padding: 20px;
  font-size: 1.1rem;
}

.btn-ghost {
  background: transparent;
  color: #3860b2;
  border: 1px solid #3860b2;
}

.btn-danger {
  background: #e74c3c;
  border: none;
  color: #fff;
}

.btn-warn {
  background: #e67e22;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 0.75rem;
}

.btn-block {
  display: block;
  width: 100%;
  margin-bottom: 12px;
}

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
}

.form-stack label {
  display: block;
  margin-bottom: 12px;
}

.form-stack .input {
  margin-top: 4px;
}

.error {
  color: #c0392b;
}

.hidden {
  display: none;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar-title {
  font-weight: 600;
  flex: 1;
}

.card {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.table-wrap {
  overflow-x: auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e8ecf2;
  text-align: left;
  vertical-align: top;
}

.data-table th.num,
.data-table td.num {
  text-align: right;
  white-space: nowrap;
}

.lots-cell {
  min-width: 280px;
}

.lot-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px dashed #eee;
}

.lot-row:last-child {
  border-bottom: none;
}

.lot-expired {
  opacity: 0.55;
}

.result-box {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-top: 16px;
}

.result-box ul {
  margin: 8px 0;
  padding-left: 1.2rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  max-width: 400px;
  width: 100%;
}

.modal h3 {
  margin: 0 0 8px;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.page-header h1 {
  flex: 1;
  text-align: center;
  font-size: 1.25rem;
  margin: 0;
  background: #d6dfee;
  padding: 10px;
  border-radius: 8px;
}

.admin-page {
  max-width: 960px;
}

.staff-master-page {
  max-width: 1280px;
}

.staff-master-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
  margin-top: 8px;
}

.staff-master-site-panel {
  min-width: 0;
}

.staff-master-site-title {
  margin: 0 0 6px;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
}

.staff-master-empty {
  margin: 0;
  font-size: 0.85rem;
  text-align: center;
}

.staff-master-table-wrap {
  overflow-x: auto;
}

.staff-master-table,
.balance-table {
  width: 100%;
  font-size: 0.76rem;
}

.staff-master-table .sm-col-order {
  width: 8%;
}

.staff-master-table .sm-col-name {
  width: 18%;
}

.staff-master-table .sm-col-active {
  width: 8%;
}

.staff-master-table .sm-col-contract {
  width: 14%;
}

.staff-master-table .sm-col-weekly {
  width: 14%;
}

.staff-master-table .sm-col-edit {
  width: 10%;
}

.staff-master-table th,
.staff-master-table td,
.balance-table th,
.balance-table td {
  text-align: center;
  white-space: normal;
  padding: 4px 3px;
}

.tc-align-center {
  text-align: center;
}

.staff-master-page .staff-master-table .row-inactive td:not(.sm-col-edit-cell),
.balance-table .row-inactive td {
  color: #7a8494;
}

.staff-master-page .staff-master-table .sm-sort-order-max {
  color: #c62828;
  font-weight: 600;
}

.grant-today {
  color: #c62828;
}

.staff-form-panel {
  margin-top: 20px;
  padding: 16px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #ccd;
}

.staff-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px 16px;
}

.staff-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
}

.input-narrow {
  max-width: 120px;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  cursor: pointer;
}

.form-hint {
  font-size: 0.8rem;
  margin: 0;
}

#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #333;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  opacity: 0;
  transition: transform 0.25s, opacity 0.25s;
  z-index: 9999;
  max-width: 90vw;
  text-align: center;
}

#toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-success {
  background: #2e7d32;
}

.toast-error {
  background: #c62828;
}

@media (max-width: 1000px) {
  .staff-master-columns {
    grid-template-columns: 1fr;
  }
}
