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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
    sans-serif;
  background: #f5f5f5;
  color: #222;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

.hidden {
  display: none !important;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-banner {
  background: #e3f2fd;
  position: sticky;
  top: 0;
  z-index: 100;
}

.banner-image {
  width: 100%;
  height: 88px;
  object-fit: cover;
  display: block;
}

.banner-placeholder {
  background: linear-gradient(135deg, #1565c0 0%, #42a5f5 100%);
}

.nav-card {
  margin: -10px 12px 4px;
  background: #fff;
  border-radius: 16px;
  padding: 8px 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.nav-row {
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 2px;
  border: none;
  background: none;
  cursor: pointer;
}

.nav-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}

.nav-icon {
  font-size: 18px;
  line-height: 1;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  color: #757575;
  text-align: center;
}

.nav-active-bar {
  width: 70%;
  height: 3px;
  border-radius: 2px;
  margin-top: 4px;
}

.nav-active-bar-placeholder {
  height: 7px;
}

.app-main {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 32px;
}

.loading-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1565c0;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.screen {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
}

.settings-screen {
  background: #f5f5f5;
  box-shadow: none;
  padding: 0;
}

.card {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
}

.screen-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 8px;
}

.screen-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}

.screen-subtitle {
  font-size: 14px;
  color: #666;
  margin: 4px 0 0;
  line-height: 1.4;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 16px;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 8px;
}

.title-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.title-icon {
  font-size: 22px;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.reset-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  cursor: pointer;
}

.reset-btn:hover {
  background: #eee;
}

.empty-text,
.empty-hint {
  font-size: 14px;
  color: #888;
  text-align: center;
  margin-top: 32px;
  line-height: 1.6;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notification-card {
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 12px 14px;
  background: #fafafa;
}

.notification-date {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 8px;
}

.notification-memo {
  font-size: 14px;
  color: #444;
  margin: 0;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

.year-month-picker {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.picker-wrap {
  flex: 1;
}

.picker-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #333;
}

.picker {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  font-size: 15px;
}

.calendar-grid {
  margin-top: 8px;
}

.calendar-week-row {
  display: flex;
  margin-bottom: 4px;
}

.calendar-weekday {
  flex: 1;
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  color: #666;
}

.calendar-days {
  display: flex;
  flex-wrap: wrap;
}

.calendar-cell {
  width: 14.28%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 2px 0;
}

.calendar-day-btn {
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
}

.day-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.holiday-circle {
  background: #ffebee;
}

.day-text {
  font-size: 15px;
  color: #333;
}

.day-text.selected {
  color: #1b5e20;
  font-weight: 700;
}

.day-text.sunday,
.calendar-weekday.sunday {
  color: #e53935;
}

.day-text.saturday,
.calendar-weekday.saturday {
  color: #1e88e5;
}

.day-text.holiday-text {
  color: #e53935;
  font-weight: 700;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #555;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.calendar-hint {
  margin-top: 12px;
  font-size: 12px;
  color: #888;
  text-align: center;
}

.mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.mode-btn {
  width: calc(33.33% - 6px);
  min-width: 90px;
  padding: 10px 4px;
  border-radius: 10px;
  border: 2px solid transparent;
  font-size: 11px;
  font-weight: 600;
  color: #333;
  text-align: center;
  cursor: pointer;
}

.mode-btn.active {
  border-color: #333;
  font-weight: 800;
}

.mode-hint {
  margin-top: 10px;
  font-size: 12px;
  color: #888;
  text-align: center;
  line-height: 1.5;
}

.btn {
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  cursor: pointer;
  min-width: 90px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-full {
  width: 100%;
}

.btn-primary {
  background: #1976d2;
}

.btn-secondary {
  background: #757575;
}

.btn-success {
  background: #4caf50;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.time-input {
  margin-bottom: 8px;
}

.time-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.time-row,
.time-field-row {
  display: flex;
  align-items: center;
}

.time-field {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px 12px;
  width: 72px;
  text-align: center;
  font-size: 16px;
}

.time-field-compact {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 6px 8px;
  width: 52px;
  min-width: 52px;
  text-align: center;
  font-size: 14px;
  background: #fafafa;
}

.time-sep {
  margin: 0 6px;
  font-size: 15px;
  color: #555;
}

.time-sep-compact {
  margin: 0 2px;
  font-size: 12px;
  color: #666;
}

.time-range-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.time-range-compact {
  flex: 1;
  justify-content: flex-end;
}

.time-tilde {
  margin: 0 4px;
  font-size: 14px;
  color: #888;
  font-weight: 600;
}

.color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 8px;
}

.color-swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.color-swatch.selected {
  border-color: #333;
}

.bulk-box {
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
  background: #fafafa;
}

.bulk-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.bulk-header h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
}

.bulk-desc {
  font-size: 12px;
  color: #666;
  margin: 0 0 12px;
}

.bulk-time-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bulk-time-col {
  flex: 1;
  min-width: 120px;
}

.bulk-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  margin-bottom: 4px;
}

.apply-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.apply-row > * {
  flex: 1;
}

.bulk-note {
  font-size: 11px;
  color: #888;
  margin: 8px 0 0;
}

.legend-box {
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
}

.legend-title {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 10px;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.legend-swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid;
  display: inline-block;
}

.day-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.day-card {
  border-radius: 12px;
  padding: 12px;
  border: 1px solid;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.date-label {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
}

.memo-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.memo-label {
  font-size: 12px;
  font-weight: 600;
  color: #555;
}

.memo-input {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  min-height: 40px;
  resize: vertical;
}

.preview-box {
  margin-top: 24px;
  padding: 16px;
  background: #f3e5f5;
  border-radius: 12px;
}

.preview-box h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 8px;
  color: #6a1b9a;
}

.preview-total {
  font-size: 14px;
  font-weight: 700;
  color: #6a1b9a;
  text-align: center;
  margin: 0 0 10px;
}

.preview-item {
  font-size: 14px;
  color: #333;
  line-height: 1.6;
  text-align: center;
  margin: 0;
}

.history-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-total {
  border-radius: 10px;
  padding: 12px 14px;
  border: 1px solid #ce93d8;
  background: #f3e5f5;
  text-align: center;
}

.history-total p {
  font-size: 14px;
  font-weight: 700;
  color: #6a1b9a;
  margin: 0;
}

.history-row {
  border-radius: 10px;
  padding: 12px 14px;
  border: 1px solid;
  text-align: center;
}

.history-row p {
  font-size: 14px;
  font-weight: 500;
  margin: 0;
  line-height: 1.4;
}

.year-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.arrow-btn {
  padding: 4px;
  border: none;
  background: none;
  font-size: 20px;
  color: #1976d2;
  cursor: pointer;
}

.year-text {
  font-size: 22px;
  font-weight: 700;
  color: #1976d2;
  min-width: 120px;
  text-align: center;
}

.month-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}

.month-chip {
  width: 40px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #fafafa;
  font-size: 14px;
  font-weight: 600;
  color: #555;
  cursor: pointer;
}

.month-chip.active {
  background: #e3f2fd;
  border-color: #1976d2;
  color: #1976d2;
  font-weight: 700;
}

.calendar-box {
  margin-bottom: 16px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #eee;
  background: #fafafa;
}

.section-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 10px;
}

.holiday-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.holiday-line {
  font-size: 14px;
  color: #333;
  line-height: 1.6;
  margin: 0;
  padding: 4px 0;
  border-bottom: 1px solid #f0f0f0;
}

.settings-card-wrap {
  margin-bottom: 16px;
}

.settings-category {
  font-size: 13px;
  font-weight: 600;
  color: #888;
  margin: 0 0 6px 4px;
}

.settings-card {
  display: flex;
  align-items: center;
  width: 100%;
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  gap: 12px;
  border: none;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.settings-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.settings-card-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-card-text strong {
  font-size: 15px;
}

.settings-card-text small {
  font-size: 12px;
  color: #888;
  line-height: 1.4;
}

.settings-card-right {
  font-size: 13px;
  font-weight: 600;
  color: #1976d2;
  margin-right: 4px;
}

.settings-chevron {
  color: #bbb;
  font-size: 12px;
}

.settings-card-body {
  background: #fff;
  border-radius: 14px;
  margin-top: 8px;
  padding: 14px;
  border: 1px solid #eee;
}

.field-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin: 8px 0 6px;
  color: #333;
}

.text-input {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  margin-bottom: 4px;
}

.text-area {
  min-height: 100px;
  resize: vertical;
}

.arrival-block {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}

.arrival-block h4 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 4px;
}

.csv-hint {
  font-size: 12px;
  color: #2e7d32;
  margin-top: 8px;
}

@media (max-width: 600px) {
  .nav-label {
    font-size: 9px;
  }

  .mode-btn {
    width: calc(50% - 4px);
  }

  .app-main {
    padding: 12px;
  }
}
