html {
  box-sizing: border-box;
}
*,
*::before,
*::after {
  box-sizing: inherit;
}

body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background-color: #f3f4f6;
}

/* 中央配置 */
.app-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

/* カードUI */
.card {
  background: white;
  padding: 30px;
  border-radius: 16px;
  width: 90%;
  max-width: 350px;
  text-align: center;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

/* タイトル */
h1 {
  margin-bottom: 5px;
}

.subtitle {
  margin-top: 0;
  font-size: 14px;
  color: #666;
}

.welcome-message {
  margin: 22px 0 18px;
  font-size: 16px;
  color: #111;
  white-space: nowrap;
}

/* 入力 */
.input-box {
  margin-top: 20px;
  width: 100%;
  height: 45px;
  font-size: 18px;
  text-align: center;
  border-radius: 8px;
  border: 1px solid #ccc;
}

/* テキストボタン */
.text-btn {
  margin-top: 20px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
}

/* メインボタン */
.main-btn {
  display: block;
  width: 100%;
  margin: 15px 0;
  padding: 15px;
  font-size: 16px;
  color: white;
  background: linear-gradient(135deg, #6ea0c9, #4d7fa8);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.1s;
}

.main-btn:active {
  transform: scale(0.97);
}

.page-shell {
  width: 100%;
  margin: 0;
  padding: 0 0 32px;
  min-height: 100vh;
  background-color: #f3f4f6;
}

.page-header {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 20px;
  margin: 0 0 24px;
  background-color: #5b8db8;
  color: #ffffff;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
}

.header-nickname {
  position: absolute;
  top: 8px;
  left: 12px;
  color: #ffffff;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  flex: 1;
  text-align: center;
}

.header-action-menu {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  padding: 8px 36px 8px 12px;
  font-size: 0.95rem;
  color: #1f2937;
  background-color: #ffffff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath d='M5.25 7.25a.75.75 0 0 1 1.06 0L10 11.94l3.69-4.69a.75.75 0 1 1 1.06 1.06l-4.22 5.37a.75.75 0 0 1-1.06 0l-4.22-5.37a.75.75 0 0 1 0-1.06Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  cursor: pointer;
  min-width: 120px;
  margin-left: auto;
}

.header-action-menu:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
}

.flyer-updates-modal {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
}

.flyer-updates-modal-hidden {
  display: none;
}

.flyer-updates-modal-content {
  width: min(560px, calc(100% - 32px));
  max-height: calc(100vh - 40px);
  padding: 24px 28px 22px;
  overflow-y: auto;
  box-sizing: border-box;
  background: #f3f3f3;
  border: 1px solid #cfcfcf;
}

.flyer-updates-modal-title {
  margin-bottom: 22px;
  text-align: center;
  font-size: 24px;
}

.flyer-updates-modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.flyer-updates-modal-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: nowrap;
}

.flyer-updates-modal-label {
  width: 120px;
  font-size: 18px;
  text-align: left;
}

.flyer-updates-modal-field {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.flyer-updates-modal-note {
  width: 100%;
  font-size: 16px;
  line-height: 1.6;
  text-align: left;
}

.flyer-updates-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 24px;
}

.flyer-updates-modal-actions button {
  min-width: 120px;
  height: 40px;
  font-size: 18px;
  border: 1px solid #b7b7b7;
  border-radius: 10px;
  background: linear-gradient(to bottom, #d6d6d6, #bfbfbf);
  cursor: pointer;
}

.primary-button {
  appearance: none;
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  background-color: #3c74a8;
  box-shadow: 0 4px 10px rgba(60, 116, 168, 0.24);
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.primary-button:hover,
.primary-button:focus-visible {
  background-color: #346091;
}

.primary-button:active {
  transform: scale(0.98);
}

.page-main {
  width: 100%;
  box-sizing: border-box;
  min-height: calc(100vh - 128px);
  padding: 0;
}

.table-card {
  width: 100%;
  margin: 0;
  background-color: #ffffff;
  border-radius: 18px;
  padding: 20px 32px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  border: 1px solid #e5e7eb;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.table-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
}

.segment-control-container {
  display: flex;
  justify-content: flex-start;
  margin: 18px 0 12px;
}

.segment-control {
  display: flex;
  gap: 0;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  overflow: hidden;
  background-color: #f3f4f6;
}

.segment-button {
  flex: 0 1 auto;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 500;
  color: #6b7280;
  background-color: #f3f4f6;
  border: none;
  border-right: 1px solid #d1d5db;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.segment-button:last-child {
  border-right: none;
}

.segment-button:hover:not(.active) {
  background-color: #e5e7eb;
  color: #4b5563;
}

.segment-button.active {
  background-color: #ffffff;
  color: #1f2937;
  font-weight: 700;
  border-right: 1px solid #d1d5db;
  box-shadow: inset 0 -2px 0 0 #3c74a8;
}

.segment-button:focus-visible {
  outline: 2px solid #3c74a8;
  outline-offset: -1px;
}

.section-description {
  margin: 0 0 18px;
  color: #4b5563;
  font-size: 0.98rem;
  line-height: 1.6;
}

.permission-3-description {
  display: none;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.permission-3-hidden {
  display: grid;
  gap: 24px;
}

.form-section-header {
  margin-bottom: 8px;
}

.section-label {
  display: inline-block;
  color: #1f4e8a;
  font-size: 1.05rem;
  font-weight: 700;
  border-bottom: 3px solid #3c74a8;
  padding-bottom: 4px;
}

.form-field {
  display: grid;
  grid-template-columns: 17% 1fr;
  gap: 0 24px;
}

.field-label {
  display: inline-flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  color: #111827;
  font-size: 0.98rem;
  font-weight: 600;
  white-space: normal;
  text-align: right;
  padding-right: 8px;
}

.field-label span {
  white-space: nowrap;
  margin-left: 2px;
}

.text-input,
.select-input,
.textarea-input {
  width: 100%;
  min-height: 48px;
  padding: 14px 16px;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  font-size: 0.98rem;
  color: #111827;
  background-color: #ffffff;
}

.readonly-input {
  color: #6b7280;
  background-color: #f3f4f6;
  border-color: #d1d5db;
  cursor: not-allowed;
}

.readonly-select {
  pointer-events: none;
}

.select-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%236b7280' d='M5.25 7.25a.75.75 0 0 1 1.06 0L10 11.94l3.69-4.69a.75.75 0 1 1 1.06 1.06l-4.22 5.37a.75.75 0 0 1-1.06 0l-4.22-5.37a.75.75 0 0 1 0-1.06Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 14px 14px;
}

.textarea-input {
  min-height: 140px;
  resize: vertical;
  line-height: 1.6;
}

.date-range-inputs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
}

.date-range-separator {
  color: #111827;
  font-size: 1rem;
  text-align: center;
}

.date-input {
  min-height: 48px;
}

.map-box {
  width: 100%;
  height: 450px;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  overflow: hidden;
  background-color: #f8fafc;
}

.map-container {
  width: 100%;
  height: 100%;
}

.readonly-map {
  filter: grayscale(0.7);
  opacity: 0.7;
}

.readonly-map .map-container {
  pointer-events: none;
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #111827;
  font-size: 0.98rem;
}

.required-badge,
.optional-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  min-height: 22px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #ffffff;
}

.required-badge {
  background-color: #dc2626;
}

.optional-badge {
  background-color: #4b5563;
}

.button-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
}

.form-button {
  flex: 0 0 auto;
  min-width: 140px;
  width: auto;
}

.secondary-button {
  appearance: none;
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  background-color: #4b5563;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.secondary-button:hover,
.secondary-button:focus-visible {
  background-color: #374151;
}

.secondary-button:active {
  transform: scale(0.98);
}

.table-header .primary-button {
  margin-left: auto;
}

.table-container {
  width: 100%;
  max-width: 100%;
  max-height: 60vh;
  overflow-x: auto;
  overflow-y: auto;
}

.tabulator {
  width: 100%;
  min-width: 1200px;
}

.section-description {
  width: 100%;
  max-width: 100%;
}

.tabulator {
  width: 100%;
  min-width: 0;
  border-radius: 14px;
  overflow: auto;
  box-shadow: inset 0 0 0 1px #e5e7eb;
  background-color: #ffffff;
}

.tabulator .tabulator-tableholder {
  min-width: auto;
}

.tabulator .tabulator-cell,
.tabulator-header .tabulator-col .tabulator-col-title {
  white-space: normal;
  word-break: break-word;
  overflow: visible;
}

.tabulator-header {
  background-color: #f9fafb;
}

.tabulator-header .tabulator-col {
  color: #1f2937;
  font-weight: 600;
  text-align: center;
}

.tabulator-header .tabulator-col .tabulator-col-title {
  display: inline-block;
  width: 100%;
  text-align: center;
}

.tabulator-row {
  transition: background-color 0.15s ease;
}

.tabulator-row:hover {
  background-color: #f8fafc;
}

.tabulator-cell {
  color: #374151;
}

@media (max-width: 960px) {
  .page-shell {
    padding: 24px 6vw;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
    padding: 18px 18px;
  }

  .table-card {
    padding: 20px 20px;
  }

  .primary-button {
    width: 100%;
    justify-self: flex-end;
  }
}

@media (max-width: 640px) {
  :root {
    font-size: 15px;
  }

  .page-shell {
    padding: 18px 5vw;
  }

  .page-title {
    font-size: 1.1rem;
  }

  .table-card {
    padding: 18px;
  }
}
